﻿#region Copyright (c) Nicola Gallo All rights reserved.
/*
 * All rights reserved. Reproduction of trasmission of this file, or a portion thereof,
 * is forbidden without prior written permission of Nicola Gallo.
 * 
 * Author: Nicola Gallo
 * Date: 09/04/2011
 * 
 * */
#endregion
namespace PrismMVC.Shell.MVC
{
    //.NET References
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    //PrismMVC References
    using PrismMVC.Shell.Containers;

    /// <summary>
    /// Defines a view result state.
    /// </summary>
    public class ViewResult : ActionResult
    {
        //Constructors

        /// <summary>
        /// Creates a new instance of <see cref="ViewResult"/>.
        /// </summary>
        /// <param name="viewType">View type.</param>
        public ViewResult(Type viewType)
        {
            if (viewType == null)
            {
                throw new ArgumentNullException("ViewType parameter can not be equals to null.");
            }
            else if (!typeof(IView).IsAssignableFrom(viewType))
            {
                throw new ArgumentException("Invalid ViewType. It has to be derived from IView.");
            }
            this.ViewType = viewType;
        }

        //Properties

        /// <summary>
        /// Gets the view type.
        /// </summary>
        public Type ViewType { get; private set; }

        /// <summary>
        /// Gets the view instance.
        /// </summary>
        public IView View { get; internal set; }
    }
}